#!/usr/bin/env python
#coding=utf-8
from sqlalchemy import or_ ,and_
from Applications.extensions import db
from .BaseModel import baseModel


class adminModel(baseModel):
	__tablename__ = 'th_admins'

	admin_id = db.Column(db.Integer,primary_key=True, nullable=False, comment='admin_id')
	admin_name = db.Column(db.String(100), nullable=False, comment='账号名')
	admin_passwd = db.Column(db.String(100), nullable=False, comment='登录密码')
	admin_Jurisdiction = db.Column(db.Integer, nullable=False, comment='权限集合')
	admin_JurisdictionType = db.Column(db.String(255), nullable=False, comment='权限类型')
	admin_loginTimer = db.Column(db.String(255), nullable=False, comment='菜单名')
	admin_CreateTime = db.Column(db.String(255), nullable=False, comment='菜单名')
	admin_del = db.Column(db.Integer, nullable=False, comment='菜单名')

	@classmethod
	def Getlist(cls):
		return None


	@classmethod
	def check_admin(cls,adminame,adminpwd):
		#adminame = 'admin'
		info = cls.query.filter(
			and_(
			cls.admin_name==adminame,cls.admin_passwd==adminpwd)
		).first()
		return info

	@classmethod
	def get_admin_all(cls):
		list = cls.query.all()
		return list